<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/category.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a></div>
    </div>
    <div class="content">
      <div id="tabs" class="htabs">
      	<a href="#tab-general"><?php echo $gobal_setting; ?></a>
      	<a href="#tab-left">焦点图片</a>
        <a href="#tab-mail">Mail Template</a>
      </div>
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
        <div id="tab-general">
          <div id="language">
            <table class="form">
              <tr rowspan=6>
              	<td><?php echo $shop_reason; ?></td>
                <td>
                <?php for($i=1;$i<7;$i++){ ?>
                	<?php echo $i;?>、<input type="text" name="shop_reason[]" size=50 value="<?php if(isset($configs[1][$i-1])){echo $configs[1][$i-1];}?>"><br /><br />
                <?php }?>
                </td>
              </tr>
              <tr>
              	<td><?php echo $text_blog_num;?></td>
              	<td><input type="text" name="blog_num" value="<?php if(isset($configs[2][0])){echo $configs[2][0];} ?>"></td>
              </tr>
      	      <tr>
            		<td>搜索关键字</td>
            		<td><input type="text" name="search_key" value="<?php if(isset($configs[3][0])){echo $configs[3][0];} ?>"><span style="color:red">关键字以","隔开</span></td>
      	      </tr>
            </table>
          </div>
        </div>
        <div id="tab-left">
          <table class="form">
            <tr>
              <td></td>
              <td><a href="javascript:void(0)" onclick='add_pic()'>上传图片</a></td>
            </tr>
      	    <tr>
          		<td>焦点图片</td>
          		<td>
          			<?php if(isset($configs[4])){ ?>
                <table class="list">
                  <thead>
                  <tr>
                      <td width="30%" class="center">Picture</td>
                      <td class="center">Url</td>
                  </tr>
                  </thead>
                  <tbody id="pic_td" >
            			<?php foreach($configs[4] as $k=>$con){$config=$con['content']; ?>
                    <tr id="pic_<?php echo $k;?>">
                      <td class="center">
            				    <a href="/image/<?php echo $config; ?>" target="_blank"><img src="/image/cache/<?php $num=strrpos($config,'.'); echo substr_replace($config,"-100x100",$num).substr($config,$num); ?>" ></a><input name="focus_pic[]" type="hidden" value="<?php echo $config;?>">
                  </td>
                  <td>
                      <input type="text" size=30 name="url_<?php echo $k?>" value="<?php echo $con['href'];?>">
                      <a href="javascript:void(0)" onclick="$('#pic_<?php echo $k?>').remove()">删除</a>
                  </td>
                  </tr>
            			<?php }?>
                  </tbody>
                </table>
          			<?php }?>
          		</td>
    	     </tr>
          </table>
        </div>
        <div id="tab-mail">
          <table class="form">
            <tr>
              <td>Register:</td>
              <td><textarea name="register" id="register"><?php if(isset($configs[5][0])){echo $configs[5][0];} ?></textarea></td>
            </tr>
          </table>
        </div>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript" src="view/javascript/ckeditor/ckeditor.js"></script> 

<script type="text/javascript"><!--
CKEDITOR.replace('register', {
  filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
  filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
  filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
  filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
  filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
  filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
});
function add_pic(){
	size=$('#pic_td img').size()+1;
	str="<tr><td class='center'>"+size+"、<img id='img_"+size+"' /><input type='hidden' name='focus_pic[]' id='path_"+size+"'></td><td><input type='text' name='url_"+size+"'></td></tr>";
	$('#pic_td').append(str);
	image_upload('path_'+size,'img_'+size);
	
}

function image_upload(field, thumb) {
	$('#dialog').remove();
	
	$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	
	$('#dialog').dialog({
		title: '<?php echo $text_image_manager; ?>',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
				$.ajax({
					url: 'index.php?route=common/filemanager/image&token=<?php echo $token; ?>&image=' + encodeURIComponent($('#' + field).val()),
					dataType: 'text',
					success: function(data) {
						$('#' + thumb).replaceWith('<img src="' + data + '" alt="" id="' + thumb + '" />');
					}
				});
			}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 
<script type="text/javascript"><!--
$('#tabs a').tabs(); 
$('#languages a').tabs();
//--></script> 
<?php echo $footer; ?>